<template>
  <div>
    <h2>你的购物车</h2>
    <p v-show="!NewCar.length">
      <i>请添加商品.</i>
    </p>
    <ul>
      <li v-for="(item, index) in NewCar" :key="index">
        {{ item.title }}-{{ item.price }}*{{ item.num }}
      </li>
    </ul>
    <p>总价:{{ total }}</p>
    <p>
      <button :disabled="false" @click="buy">购买</button>
    </p>
    <p v-show="checkOut">购买{{ checkOut }}</p>
  </div>
</template>

<script>
import { mapGetters, mapActions, mapState } from "vuex";
export default {
  computed: {
    ...mapGetters("car", ["NewCar", "total"]),
    ...mapState("car", ["checkOut"]),
  },
  methods: {
    ...mapActions("car", ["buy"]),
  },
  mounted() {},
};
</script>

<style scoped></style>
